function showPanel(id) {
    var url = "admin.php?action=getImgContent&id="+id;
    $.colorbox({
        width: "60%",
        height: "500px",
        html: '<div id="panelContent"><div style="width:100%;position:absolute; top:220px; text-align:center;font-size:30px;font-family:arial;font-wight:bold;">Loading...</div></div>',
        onComplete: function() {
            //$.colorbox.resize();
            $.getJSON(url,function(data){
                if (data['result']=='success') {
                    $("#panelContent").html(data['content']);
                }        
            });
        }
    });
}


function setPic() {
    $("#loading").css("display","none");
    $("#sourceImg").removeAttr("style");
    $.colorbox.resize();
}

function renewPic(direct) {
    $(".coll-div").css("display","none");
    if (direct=="right") {
        var url = "index.php?action=renewPic&direct="+direct+"&id="+$("#lastId").val();
    }
    else if (direct=="left") {
        var url = "index.php?action=renewPic&direct="+direct+"&id="+$("#firstId").val();
    }
    $.getJSON(url,function(data){
        if (data['result']=="success") {
            $(".coll-div").html(data['content']);
            $(".coll-div").css("display","block");
            $("#firstId").val(data['firstId']);
            $("#lastId").val(data['lastId']);
            if (!($(".left-button").length>0)) {
                $('.coll-div').after('<a class="left-button" href="javascript:void(0);" onclick="renewPic(\'left\')"></a>');
            }
            if (!($(".right-button").length>0)) {
                $('.coll-div').before('<a class="right-button" href="javascript:void(0);" onclick="renewPic(\'right\')"></a>');
            }
            if (direct=="left" && $(".left-button").length>0 && data['noMore']) {
                $(".left-button").remove();
            }
            else if (direct=="right" && $(".right-button").length>0 && data['noMore']) {
                $(".right-button").remove();
            }
        }      
    });
}
function doDel(o){
     window.location=o.attr("href");
              
}
function showLoading(id){

    $("#"+id).html("<img src='asset/images/uploading.gif' alt='正在上传中' />");

}
function hideLoading(id){

    $("#"+id).html(" ");

}
function getBroswer(){
    if (window.XMLHttpRequest) { //Mozilla, Safari,IE7   
        if(!window.ActiveXObject){ // Mozilla, Safari,   
            return 'other';   
        } else {   
            return 'IE7';   
        }   
    } else {   
        return 'IE6';   
    }  
}
